www.gusucode.com > VC++ 自制SQL数据库,含有服务端+客户端-源码程序 > VC++ 自制SQL数据库,含有服务端+客户端-源码程序/code/Client/RichEdit.cpp
// RichEdit.cpp : implementation file // Download by http://www.NewXing.com #include "stdafx.h" #include "Client.h" #include "RichEdit.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRichEdit CRichEdit::CRichEdit() { } CRichEdit::~CRichEdit() { } BEGIN_MESSAGE_MAP(CRichEdit, CRichEditCtrl) //{{AFX_MSG_MAP(CRichEdit) ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRichEdit message handlers void CRichEdit::SetMenuID( UINT nID ) { m_menuID = nID; } UINT CRichEdit::GetMenuID() { return m_menuID; } void CRichEdit::OnRButtonDown(UINT nFlags, CPoint point) { CRichEditCtrl::OnRButtonDown(nFlags, point); CRect Rect; GetClientRect(Rect); ClientToScreen(Rect); point.Offset( Rect.TopLeft() ); CMenu menu; VERIFY( menu.LoadMenu( m_menuID ) ); CMenu* pPop = menu.GetSubMenu( 0 ); ASSERT( pPop ); CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD) pWndPopupOwner = pWndPopupOwner->GetParent(); pPop->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); }